<!DOCTYPE html>
<html lang="zh-Hans" dir="ltr">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>Markdown 扩展示例 | VitePress基础框架</title>
    <meta name="description" content="VitePress基础框架的站点描述">
    <meta name="generator" content="VitePress v1.3.4">
    <link rel="preload stylesheet" href="/vitepress-template-public/assets/style.BlgVYu-Y.css" as="style">
    <script type="module" src="/vitepress-template-public/assets/chunks/metadata.e7f3cd1f.js"></script>
    <script type="module" src="/vitepress-template-public/assets/app.B7Bvz4Bc.js"></script>
    <link rel="preload" href="/vitepress-template-public/assets/inter-roman-latin.Di8DUHzh.woff2" as="font" type="font/woff2" crossorigin="">
    <link rel="modulepreload" href="/vitepress-template-public/assets/chunks/theme.B1DMWA2k.js">
    <link rel="modulepreload" href="/vitepress-template-public/assets/chunks/framework.D5O-cTmz.js">
    <link rel="modulepreload" href="/vitepress-template-public/assets/examples_markdown-expand.md.CsCBY_ur.lean.js">
    <link rel="icon" type="image/svg+xml" href="./logo/vitepress-logo-mini.svg">
    <link rel="icon" type="image/png" href="./logo/vitepress-logo-mini.png">
    <script id="check-dark-mode">(()=>{const e=localStorage.getItem("vitepress-theme-appearance")||"auto",a=window.matchMedia("(prefers-color-scheme: dark)").matches;(!e||e==="auto"?a:e==="dark")&&document.documentElement.classList.add("dark")})();</script>
    <script id="check-mac-os">document.documentElement.classList.toggle("mac",/Mac|iPhone|iPod|iPad/i.test(navigator.platform));</script>
  </head>
  <body>
    <div id="app"><div class="Layout" data-v-b928bd87><!--[--><!--]--><!--[--><span tabindex="-1" data-v-7de6d21b></span><a href="#VPContent" class="VPSkipLink visually-hidden" data-v-7de6d21b> Skip to content </a><!--]--><!----><header class="VPNav" data-v-b928bd87 data-v-7614e298><div class="VPNavBar" data-v-7614e298 data-v-4a78392f><div class="wrapper" data-v-4a78392f><div class="container" data-v-4a78392f><div class="title" data-v-4a78392f><div class="VPNavBarTitle has-sidebar" data-v-4a78392f data-v-a1bbf3b8><a class="title" href="/vitepress-template-public/" data-v-a1bbf3b8><!--[--><!--]--><!--[--><img class="VPImage logo" src="/vitepress-template-public/logo/vitepress-logo-mini.svg" width="24" height="24" alt data-v-5f4c361e><!--]--><span data-v-a1bbf3b8>VitePress基础框架</span><!--[--><!--]--></a></div></div><div class="content" data-v-4a78392f><div class="content-body" data-v-4a78392f><!--[--><!--]--><div class="VPNavBarSearch search" data-v-4a78392f><!----></div><nav aria-labelledby="main-nav-aria-label" class="VPNavBarMenu menu" data-v-4a78392f data-v-1eb62029><span id="main-nav-aria-label" class="visually-hidden" data-v-1eb62029> Main Navigation </span><!--[--><!--[--><a class="VPLink link VPNavBarMenuLink" href="/vitepress-template-public/guide/install" tabindex="0" data-v-1eb62029 data-v-c4db28c0><!--[--><span data-v-c4db28c0>教程</span><!--]--></a><!--]--><!--[--><a class="VPLink link VPNavBarMenuLink active" href="/vitepress-template-public/examples/markdown" tabindex="0" data-v-1eb62029 data-v-c4db28c0><!--[--><span data-v-c4db28c0>示例</span><!--]--></a><!--]--><!--[--><div class="VPFlyout VPNavBarMenuGroup" data-v-1eb62029 data-v-8c3a7de4><button type="button" class="button" aria-haspopup="true" aria-expanded="false" data-v-8c3a7de4><span class="text" data-v-8c3a7de4><!----><span data-v-8c3a7de4>下拉导航</span><span class="vpi-chevron-down text-icon" data-v-8c3a7de4></span></span></button><div class="menu" data-v-8c3a7de4><div class="VPMenu" data-v-8c3a7de4 data-v-387194d2><div class="items" data-v-387194d2><!--[--><!--[--><div class="VPMenuGroup" data-v-387194d2 data-v-91ebaee2><p class="title" data-v-91ebaee2>下拉导航标题</p><!--[--><!--[--><div class="VPMenuLink" data-v-91ebaee2 data-v-f484e6ee><a class="VPLink link vp-external-link-icon" href="https://github.com/dcdy/vitepress-template/edit/main/docs/.vitepress/config.mts" target="_blank" rel="noreferrer" data-v-f484e6ee><!--[-->子项A<!--]--></a></div><!--]--><!--[--><div class="VPMenuLink" data-v-91ebaee2 data-v-f484e6ee><a class="VPLink link vp-external-link-icon" href="https://gitee.com/xia_mei_ting/vitepress-template/blob/main/docs/.vitepress/config.mts" target="_blank" rel="noreferrer" data-v-f484e6ee><!--[-->子项B<!--]--></a></div><!--]--><!--]--></div><!--]--><!--]--></div><!--[--><!--]--></div></div></div><!--]--><!--]--></nav><!----><div class="VPNavBarAppearance appearance" data-v-4a78392f data-v-429aef54><button class="VPSwitch VPSwitchAppearance" type="button" role="switch" title aria-checked="false" data-v-429aef54 data-v-51f78c2c data-v-7bf662e2><span class="check" data-v-7bf662e2><span class="icon" data-v-7bf662e2><!--[--><span class="vpi-sun sun" data-v-51f78c2c></span><span class="vpi-moon moon" data-v-51f78c2c></span><!--]--></span></span></button></div><div class="VPSocialLinks VPNavBarSocialLinks social-links" data-v-4a78392f data-v-efa425a3 data-v-c2882db4><!--[--><a class="VPSocialLink no-icon" href="https://github.com/dcdy/vitepress-template" aria-label="github" target="_blank" rel="noopener" data-v-c2882db4 data-v-788a0e61><span class="vpi-social-github" /></a><a class="VPSocialLink no-icon" href="https://gitee.com/xia_mei_ting/vitepress-template" aria-label target="_blank" rel="noopener" data-v-c2882db4 data-v-788a0e61><svg t="1727428813465" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2268" width="200" height="200"><path d="M512 1024C229.222 1024 0 794.778 0 512S229.222 0 512 0s512 229.222 512 512-229.222 512-512 512z m259.149-568.883h-290.74a25.293 25.293 0 0 0-25.292 25.293l-0.026 63.206c0 13.952 11.315 25.293 25.267 25.293h177.024c13.978 0 25.293 11.315 25.293 25.267v12.646a75.853 75.853 0 0 1-75.853 75.853h-240.23a25.293 25.293 0 0 1-25.267-25.293V417.203a75.853 75.853 0 0 1 75.827-75.853h353.946a25.293 25.293 0 0 0 25.267-25.292l0.077-63.207a25.293 25.293 0 0 0-25.268-25.293H417.152a189.62 189.62 0 0 0-189.62 189.645V771.15c0 13.977 11.316 25.293 25.294 25.293h372.94a170.65 170.65 0 0 0 170.65-170.65V480.384a25.293 25.293 0 0 0-25.293-25.267z" fill="#C71D23" p-id="2269"></path></svg></a><!--]--></div><div class="VPFlyout VPNavBarExtra extra" data-v-4a78392f data-v-12aa81bd data-v-8c3a7de4><button type="button" class="button" aria-haspopup="true" aria-expanded="false" aria-label="extra navigation" data-v-8c3a7de4><span class="vpi-more-horizontal icon" data-v-8c3a7de4></span></button><div class="menu" data-v-8c3a7de4><div class="VPMenu" data-v-8c3a7de4 data-v-387194d2><!----><!--[--><!--[--><!----><div class="group" data-v-12aa81bd><div class="item appearance" data-v-12aa81bd><p class="label" data-v-12aa81bd>主题</p><div class="appearance-action" data-v-12aa81bd><button class="VPSwitch VPSwitchAppearance" type="button" role="switch" title aria-checked="false" data-v-12aa81bd data-v-51f78c2c data-v-7bf662e2><span class="check" data-v-7bf662e2><span class="icon" data-v-7bf662e2><!--[--><span class="vpi-sun sun" data-v-51f78c2c></span><span class="vpi-moon moon" data-v-51f78c2c></span><!--]--></span></span></button></div></div></div><div class="group" data-v-12aa81bd><div class="item social-links" data-v-12aa81bd><div class="VPSocialLinks social-links-list" data-v-12aa81bd data-v-c2882db4><!--[--><a class="VPSocialLink no-icon" href="https://github.com/dcdy/vitepress-template" aria-label="github" target="_blank" rel="noopener" data-v-c2882db4 data-v-788a0e61><span class="vpi-social-github" /></a><a class="VPSocialLink no-icon" href="https://gitee.com/xia_mei_ting/vitepress-template" aria-label target="_blank" rel="noopener" data-v-c2882db4 data-v-788a0e61><svg t="1727428813465" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2268" width="200" height="200"><path d="M512 1024C229.222 1024 0 794.778 0 512S229.222 0 512 0s512 229.222 512 512-229.222 512-512 512z m259.149-568.883h-290.74a25.293 25.293 0 0 0-25.292 25.293l-0.026 63.206c0 13.952 11.315 25.293 25.267 25.293h177.024c13.978 0 25.293 11.315 25.293 25.267v12.646a75.853 75.853 0 0 1-75.853 75.853h-240.23a25.293 25.293 0 0 1-25.267-25.293V417.203a75.853 75.853 0 0 1 75.827-75.853h353.946a25.293 25.293 0 0 0 25.267-25.292l0.077-63.207a25.293 25.293 0 0 0-25.268-25.293H417.152a189.62 189.62 0 0 0-189.62 189.645V771.15c0 13.977 11.316 25.293 25.294 25.293h372.94a170.65 170.65 0 0 0 170.65-170.65V480.384a25.293 25.293 0 0 0-25.293-25.267z" fill="#C71D23" p-id="2269"></path></svg></a><!--]--></div></div></div><!--]--><!--]--></div></div></div><!--[--><!--]--><button type="button" class="VPNavBarHamburger hamburger" aria-label="mobile navigation" aria-expanded="false" aria-controls="VPNavScreen" data-v-4a78392f data-v-8aa5fe9b><span class="container" data-v-8aa5fe9b><span class="top" data-v-8aa5fe9b></span><span class="middle" data-v-8aa5fe9b></span><span class="bottom" data-v-8aa5fe9b></span></span></button></div></div></div></div><div class="divider" data-v-4a78392f><div class="divider-line" data-v-4a78392f></div></div></div><!----></header><div class="VPLocalNav has-sidebar empty" data-v-b928bd87 data-v-84e6a0db><div class="container" data-v-84e6a0db><button class="menu" aria-expanded="false" aria-controls="VPSidebarNav" data-v-84e6a0db><span class="vpi-align-left menu-icon" data-v-84e6a0db></span><span class="menu-text" data-v-84e6a0db>菜单</span></button><div class="VPLocalNavOutlineDropdown" style="--vp-vh:0px;" data-v-84e6a0db data-v-39065feb><button data-v-39065feb>回到顶部</button><!----></div></div></div><aside class="VPSidebar" data-v-b928bd87 data-v-754706ac><div class="curtain" data-v-754706ac></div><nav class="nav" id="VPSidebarNav" aria-labelledby="sidebar-aria-label" tabindex="-1" data-v-754706ac><span class="visually-hidden" id="sidebar-aria-label" data-v-754706ac> Sidebar Navigation </span><!--[--><!--]--><!--[--><div class="no-transition group" data-v-a51db1f1><section class="VPSidebarItem level-0 has-active" data-v-a51db1f1 data-v-39a5995e><div class="item" role="button" tabindex="0" data-v-39a5995e><div class="indicator" data-v-39a5995e></div><h2 class="text" data-v-39a5995e>示例</h2><!----></div><div class="items" data-v-39a5995e><!--[--><section class="VPSidebarItem level-1 has-active" data-v-39a5995e data-v-39a5995e><div class="item" role="button" tabindex="0" data-v-39a5995e><div class="indicator" data-v-39a5995e></div><h3 class="text" data-v-39a5995e>Markdown</h3><!----></div><div class="items" data-v-39a5995e><!--[--><div class="VPSidebarItem level-2 is-link" data-v-39a5995e data-v-39a5995e><div class="item" data-v-39a5995e><div class="indicator" data-v-39a5995e></div><a class="VPLink link link" href="/vitepress-template-public/examples/markdown" data-v-39a5995e><!--[--><p class="text" data-v-39a5995e>基础示例</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-2 is-link" data-v-39a5995e data-v-39a5995e><div class="item" data-v-39a5995e><div class="indicator" data-v-39a5995e></div><a class="VPLink link link" href="/vitepress-template-public/examples/markdown-expand" data-v-39a5995e><!--[--><p class="text" data-v-39a5995e>扩展示例</p><!--]--></a><!----></div><!----></div><!--]--></div></section><div class="VPSidebarItem level-1 is-link" data-v-39a5995e data-v-39a5995e><div class="item" data-v-39a5995e><div class="indicator" data-v-39a5995e></div><a class="VPLink link link" href="/vitepress-template-public/examples/api" data-v-39a5995e><!--[--><p class="text" data-v-39a5995e>API</p><!--]--></a><!----></div><!----></div><!--]--></div></section></div><!--]--><!--[--><!--]--></nav></aside><div class="VPContent has-sidebar" id="VPContent" data-v-b928bd87 data-v-5d97ccec><div class="VPDoc has-sidebar has-aside" data-v-5d97ccec data-v-184b3be7><!--[--><!--]--><div class="container" data-v-184b3be7><div class="aside" data-v-184b3be7><div class="aside-curtain" data-v-184b3be7></div><div class="aside-container" data-v-184b3be7><div class="aside-content" data-v-184b3be7><div class="VPDocAside" data-v-184b3be7 data-v-f6e4fd1a><!--[--><!--]--><!--[--><!--]--><nav aria-labelledby="doc-outline-aria-label" class="VPDocAsideOutline" data-v-f6e4fd1a data-v-c582f5e1><div class="content" data-v-c582f5e1><div class="outline-marker" data-v-c582f5e1></div><div aria-level="2" class="outline-title" id="doc-outline-aria-label" role="heading" data-v-c582f5e1>页面导航</div><ul class="VPDocOutlineItem root" data-v-c582f5e1 data-v-9dd79648><!--[--><!--]--></ul></div></nav><!--[--><!--]--><div class="spacer" data-v-f6e4fd1a></div><!--[--><!--]--><!----><!--[--><!--]--><!--[--><!--]--></div></div></div></div><div class="content" data-v-184b3be7><div class="content-container" data-v-184b3be7><!--[--><!--]--><main class="main" data-v-184b3be7><div style="position:relative;" class="vp-doc _vitepress-template-public_examples_markdown-expand external-link-icon-enabled" data-v-184b3be7><div><h1 id="markdown-扩展示例" tabindex="-1">Markdown 扩展示例 <a class="header-anchor" href="#markdown-扩展示例" aria-label="Permalink to &quot;Markdown 扩展示例&quot;">​</a></h1><p>本页演示了 VitePress 提供的内置 markdown 扩展。</p><h2 id="emoji" tabindex="-1">Emoji 🎉 <a class="header-anchor" href="#emoji" aria-label="Permalink to &quot;Emoji :tada:&quot;">​</a></h2><p><strong>输入</strong></p><div class="language- line-numbers-mode"><button title="复制代码" class="copy"></button><span class="lang"></span><pre class="shiki one-dark-pro vp-code" tabindex="0"><code><span class="line"><span>:tada: :100:</span></span></code></pre><div class="line-numbers-wrapper" aria-hidden="true"><span class="line-number">1</span><br></div></div><p><strong>输出</strong></p><p>🎉 💯</p><p>这里可以找到<a href="https://github.com/markdown-it/markdown-it-emoji/blob/master/lib/data/full.mjs" target="_blank" rel="noreferrer">所有支持的 emoji 列表</a>。</p><h2 id="table-of-contents" tabindex="-1">目录表 (TOC) <a class="header-anchor" href="#table-of-contents" aria-label="Permalink to &quot;目录表 (TOC) {#table-of-contents}&quot;">​</a></h2><div class="language- line-numbers-mode"><button title="复制代码" class="copy"></button><span class="lang"></span><pre class="shiki one-dark-pro vp-code" tabindex="0"><code><span class="line"><span>[[toc]]</span></span></code></pre><div class="line-numbers-wrapper" aria-hidden="true"><span class="line-number">1</span><br></div></div><details class="details custom-block"><summary>点击查看目录</summary><nav class="table-of-contents"><ul><li><a href="#emoji">Emoji 🎉</a></li><li><a href="#table-of-contents">目录表 (TOC)</a></li><li><a href="#导入代码片段">导入代码片段</a><ul><li><a href="#导入全部内容">导入全部内容</a></li><li><a href="#导入全部内容且高亮某一行">导入全部内容且高亮某一行</a></li><li><a href="#导入指定内容">导入指定内容</a></li><li><a href="#指定文件语言">指定文件语言</a></li></ul></li><li><a href="#代码组">代码组</a></li><li><a href="#包含-markdown-文件">包含 markdown 文件</a></li><li><a href="#更多">更多</a></li></ul></nav></details><p>可以使用 <code>markdown.toc</code> 选项<a href="https://github.com/mdit-vue/mdit-vue/tree/main/packages/plugin-toc#options" target="_blank" rel="noreferrer">配置 TOC</a> 的呈现效果。</p><h2 id="导入代码片段" tabindex="-1">导入代码片段 <a class="header-anchor" href="#导入代码片段" aria-label="Permalink to &quot;导入代码片段&quot;">​</a></h2><div class="note custom-block github-alert"><p class="custom-block-title">提醒</p><p></p><p>下面<code>@/filepath</code>是导入的文件路径。示例路径是<code>@/public/snippet.js</code> @ 的值对应于源代码根目录，默认情况下是 VitePress 项目根目录，除非配置了 srcDir。或者也可以从相对路径导入：</p></div><h3 id="导入全部内容" tabindex="-1">导入全部内容 <a class="header-anchor" href="#导入全部内容" aria-label="Permalink to &quot;导入全部内容&quot;">​</a></h3><p><code>&lt;&lt;&lt; @/filepath</code></p><div class="language-markdown line-numbers-mode"><button title="复制代码" class="copy"></button><span class="lang">markdown</span><pre class="shiki one-dark-pro vp-code" tabindex="0"><code><span class="line"><span style="color:#ABB2BF;">&lt;&lt;&lt; @/public/snippet.js [snippet.js 别名]</span></span></code></pre><div class="line-numbers-wrapper" aria-hidden="true"><span class="line-number">1</span><br></div></div><div class="code-label"><div class="code-label-text">snippet.js 别名</div></div><div class="language-js line-numbers-mode"><button title="复制代码" class="copy"></button><span class="lang">js</span><pre class="shiki one-dark-pro vp-code" tabindex="0"><code><span class="line"><span style="color:#7F848E;font-style:italic;">// 导入代码片段示例</span></span>
<span class="line"><span style="color:#7F848E;font-style:italic;">// #region snippet1</span></span>
<span class="line"><span style="color:#C678DD;">function</span><span style="color:#61AFEF;"> foo1</span><span style="color:#ABB2BF;">() {</span></span>
<span class="line"><span style="color:#7F848E;font-style:italic;">	// ..</span></span>
<span class="line"><span style="color:#ABB2BF;">}</span></span>
<span class="line"><span style="color:#7F848E;font-style:italic;">// #endregion snippet1</span></span>
<span class="line"></span>
<span class="line"><span style="color:#7F848E;font-style:italic;">// #region snippet2</span></span>
<span class="line"><span style="color:#C678DD;">function</span><span style="color:#61AFEF;"> foo2</span><span style="color:#ABB2BF;">() {</span></span>
<span class="line"><span style="color:#7F848E;font-style:italic;">	// ..</span></span>
<span class="line"><span style="color:#ABB2BF;">}</span></span>
<span class="line"><span style="color:#7F848E;font-style:italic;">// #endregion snippet2</span></span></code></pre><div class="line-numbers-wrapper" aria-hidden="true"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br></div></div><h3 id="导入全部内容且高亮某一行" tabindex="-1">导入全部内容且高亮某一行 <a class="header-anchor" href="#导入全部内容且高亮某一行" aria-label="Permalink to &quot;导入全部内容且高亮某一行&quot;">​</a></h3><p><code>&lt;&lt;&lt; @/filepath{高亮行号}</code></p><div class="language-markdown line-numbers-mode"><button title="复制代码" class="copy"></button><span class="lang">markdown</span><pre class="shiki one-dark-pro vp-code" tabindex="0"><code><span class="line"><span style="color:#ABB2BF;">&lt;&lt;&lt; @/public/snippet.js{3}</span></span></code></pre><div class="line-numbers-wrapper" aria-hidden="true"><span class="line-number">1</span><br></div></div><div class="language-js line-numbers-mode"><button title="复制代码" class="copy"></button><span class="lang">js</span><pre class="shiki one-dark-pro vp-code" tabindex="0"><code><span class="line"><span style="color:#7F848E;font-style:italic;">// 导入代码片段示例</span></span>
<span class="line"><span style="color:#7F848E;font-style:italic;">// #region snippet1</span></span>
<span class="line highlighted"><span style="color:#C678DD;">function</span><span style="color:#61AFEF;"> foo1</span><span style="color:#ABB2BF;">() {</span></span>
<span class="line"><span style="color:#7F848E;font-style:italic;">	// ..</span></span>
<span class="line"><span style="color:#ABB2BF;">}</span></span>
<span class="line"><span style="color:#7F848E;font-style:italic;">// #endregion snippet1</span></span>
<span class="line"></span>
<span class="line"><span style="color:#7F848E;font-style:italic;">// #region snippet2</span></span>
<span class="line"><span style="color:#C678DD;">function</span><span style="color:#61AFEF;"> foo2</span><span style="color:#ABB2BF;">() {</span></span>
<span class="line"><span style="color:#7F848E;font-style:italic;">	// ..</span></span>
<span class="line"><span style="color:#ABB2BF;">}</span></span>
<span class="line"><span style="color:#7F848E;font-style:italic;">// #endregion snippet2</span></span></code></pre><div class="line-numbers-wrapper" aria-hidden="true"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br></div></div><h3 id="导入指定内容" tabindex="-1">导入指定内容 <a class="header-anchor" href="#导入指定内容" aria-label="Permalink to &quot;导入指定内容&quot;">​</a></h3><p>可以使用 <a href="https://code.visualstudio.com/docs/editor/codebasics#_folding" target="_blank" rel="noreferrer">VS Code region</a> 来只包含代码文件的相应部分。可以在文件目录后面的 # 符号后提供一个自定义的区域名：</p><p><code>&lt;&lt;&lt; @/filepath#该文件中自定义的区域名{高亮行号}</code></p><div class="language-markdown line-numbers-mode"><button title="复制代码" class="copy"></button><span class="lang">markdown</span><pre class="shiki one-dark-pro vp-code" tabindex="0"><code><span class="line"><span style="color:#ABB2BF;">&lt;&lt;&lt; @/public/snippet.js#snippet1{1}</span></span></code></pre><div class="line-numbers-wrapper" aria-hidden="true"><span class="line-number">1</span><br></div></div><div class="language-js line-numbers-mode"><button title="复制代码" class="copy"></button><span class="lang">js</span><pre class="shiki one-dark-pro vp-code" tabindex="0"><code><span class="line highlighted"><span style="color:#C678DD;">function</span><span style="color:#61AFEF;"> foo1</span><span style="color:#ABB2BF;">() {</span></span>
<span class="line"><span style="color:#7F848E;font-style:italic;">	// ..</span></span>
<span class="line"><span style="color:#ABB2BF;">}</span></span></code></pre><div class="line-numbers-wrapper" aria-hidden="true"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br></div></div><h3 id="指定文件语言" tabindex="-1">指定文件语言 <a class="header-anchor" href="#指定文件语言" aria-label="Permalink to &quot;指定文件语言&quot;">​</a></h3><p><code>&lt;&lt;&lt; @/filepath#该文件中自定义的区域名{高亮行号 指定语言:显示行号}</code></p><div class="language-markdown line-numbers-mode"><button title="复制代码" class="copy"></button><span class="lang">markdown</span><pre class="shiki one-dark-pro vp-code" tabindex="0"><code><span class="line"><span style="color:#ABB2BF;">&lt;&lt;&lt; @/public/snippet.js#snippet1{1 vue:line-numbers=2}</span></span></code></pre><div class="line-numbers-wrapper" aria-hidden="true"><span class="line-number">1</span><br></div></div><div class="language-vue line-numbers-mode"><button title="复制代码" class="copy"></button><span class="lang">vue</span><pre class="shiki one-dark-pro vp-code" tabindex="0"><code><span class="line highlighted"><span style="color:#ABB2BF;">function foo1() {</span></span>
<span class="line"><span style="color:#ABB2BF;">	// ..</span></span>
<span class="line"><span style="color:#ABB2BF;">}</span></span></code></pre><div class="line-numbers-wrapper" aria-hidden="true"><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br></div></div><h2 id="代码组" tabindex="-1">代码组 <a class="header-anchor" href="#代码组" aria-label="Permalink to &quot;代码组&quot;">​</a></h2><div class="language-markdown line-numbers-mode"><button title="复制代码" class="copy"></button><span class="lang">markdown</span><pre class="shiki one-dark-pro vp-code" tabindex="0"><code><span class="line"><span style="color:#ABB2BF;">::: code-group</span></span>
<span class="line"></span>
<span class="line"><span style="color:#ABB2BF;">```js [config.js]</span></span>
<span class="line"><span style="color:#7F848E;font-style:italic;">/**</span></span>
<span class="line"><span style="color:#7F848E;font-style:italic;"> * </span><span style="color:#C678DD;font-style:italic;">@type</span><span style="color:#E5C07B;font-style:italic;"> {import(&#39;vitepress&#39;).UserConfig}</span></span>
<span class="line"><span style="color:#7F848E;font-style:italic;"> */</span></span>
<span class="line"><span style="color:#C678DD;">const</span><span style="color:#E5C07B;"> config</span><span style="color:#56B6C2;"> =</span><span style="color:#ABB2BF;"> {</span></span>
<span class="line"><span style="color:#7F848E;font-style:italic;">	// ...</span></span>
<span class="line"><span style="color:#ABB2BF;">};</span></span>
<span class="line"></span>
<span class="line"><span style="color:#C678DD;">export</span><span style="color:#C678DD;"> default</span><span style="color:#E06C75;"> config</span><span style="color:#ABB2BF;">;</span></span>
<span class="line"><span style="color:#ABB2BF;">```</span></span>
<span class="line"></span>
<span class="line"><span style="color:#ABB2BF;">```ts [config.ts]</span></span>
<span class="line"><span style="color:#C678DD;">import</span><span style="color:#C678DD;"> type</span><span style="color:#ABB2BF;"> { </span><span style="color:#E06C75;">UserConfig</span><span style="color:#ABB2BF;"> } </span><span style="color:#C678DD;">from</span><span style="color:#98C379;"> &#39;vitepress&#39;</span><span style="color:#ABB2BF;">;</span></span>
<span class="line"></span>
<span class="line"><span style="color:#C678DD;">const</span><span style="color:#E5C07B;"> config</span><span style="color:#ABB2BF;">: </span><span style="color:#E5C07B;">UserConfig</span><span style="color:#56B6C2;"> =</span><span style="color:#ABB2BF;"> {</span></span>
<span class="line"><span style="color:#7F848E;font-style:italic;">	// ...</span></span>
<span class="line"><span style="color:#ABB2BF;">};</span></span>
<span class="line"></span>
<span class="line"><span style="color:#C678DD;">export</span><span style="color:#C678DD;"> default</span><span style="color:#E06C75;"> config</span><span style="color:#ABB2BF;">;</span></span>
<span class="line"><span style="color:#ABB2BF;">```</span></span>
<span class="line"></span>
<span class="line"><span style="color:#7F848E;font-style:italic;">&lt;!-- 代码片段示例 --&gt;</span></span>
<span class="line"></span>
<span class="line"><span style="color:#ABB2BF;">&lt;&lt;&lt; @/public/snippet.js#snippet1{1,3 ts:line-numbers=1} [snippet.js 别名]</span></span>
<span class="line"></span>
<span class="line"><span style="color:#ABB2BF;">:::</span></span></code></pre><div class="line-numbers-wrapper" aria-hidden="true"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br><span class="line-number">17</span><br><span class="line-number">18</span><br><span class="line-number">19</span><br><span class="line-number">20</span><br><span class="line-number">21</span><br><span class="line-number">22</span><br><span class="line-number">23</span><br><span class="line-number">24</span><br><span class="line-number">25</span><br><span class="line-number">26</span><br><span class="line-number">27</span><br><span class="line-number">28</span><br></div></div><div class="vp-code-group"><div class="tabs"><input type="radio" name="group-ILSCt" id="tab-bXzoblW" checked><label for="tab-bXzoblW">config.js</label><input type="radio" name="group-ILSCt" id="tab-RGnl263"><label for="tab-RGnl263">config.ts</label><input type="radio" name="group-ILSCt" id="tab-CGc_UI4"><label for="tab-CGc_UI4">snippet.js 别名</label></div><div class="blocks"><div class="language-js active line-numbers-mode"><button title="复制代码" class="copy"></button><span class="lang">js</span><pre class="shiki one-dark-pro vp-code" tabindex="0"><code><span class="line"><span style="color:#7F848E;font-style:italic;">/**</span></span>
<span class="line"><span style="color:#7F848E;font-style:italic;"> * </span><span style="color:#C678DD;font-style:italic;">@type</span><span style="color:#E5C07B;font-style:italic;"> {import(&#39;vitepress&#39;).UserConfig}</span></span>
<span class="line"><span style="color:#7F848E;font-style:italic;"> */</span></span>
<span class="line"><span style="color:#C678DD;">const</span><span style="color:#E5C07B;"> config</span><span style="color:#56B6C2;"> =</span><span style="color:#ABB2BF;"> {</span></span>
<span class="line"><span style="color:#7F848E;font-style:italic;">	// ...</span></span>
<span class="line"><span style="color:#ABB2BF;">};</span></span>
<span class="line"></span>
<span class="line"><span style="color:#C678DD;">export</span><span style="color:#C678DD;"> default</span><span style="color:#E06C75;"> config</span><span style="color:#ABB2BF;">;</span></span></code></pre><div class="line-numbers-wrapper" aria-hidden="true"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br></div></div><div class="language-ts line-numbers-mode"><button title="复制代码" class="copy"></button><span class="lang">ts</span><pre class="shiki one-dark-pro vp-code" tabindex="0"><code><span class="line"><span style="color:#C678DD;">import</span><span style="color:#C678DD;"> type</span><span style="color:#ABB2BF;"> { </span><span style="color:#E06C75;">UserConfig</span><span style="color:#ABB2BF;"> } </span><span style="color:#C678DD;">from</span><span style="color:#98C379;"> &#39;vitepress&#39;</span><span style="color:#ABB2BF;">;</span></span>
<span class="line"></span>
<span class="line"><span style="color:#C678DD;">const</span><span style="color:#E5C07B;"> config</span><span style="color:#ABB2BF;">: </span><span style="color:#E5C07B;">UserConfig</span><span style="color:#56B6C2;"> =</span><span style="color:#ABB2BF;"> {</span></span>
<span class="line"><span style="color:#7F848E;font-style:italic;">	// ...</span></span>
<span class="line"><span style="color:#ABB2BF;">};</span></span>
<span class="line"></span>
<span class="line"><span style="color:#C678DD;">export</span><span style="color:#C678DD;"> default</span><span style="color:#E06C75;"> config</span><span style="color:#ABB2BF;">;</span></span></code></pre><div class="line-numbers-wrapper" aria-hidden="true"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br></div></div><div class="language-ts line-numbers-mode"><button title="复制代码" class="copy"></button><span class="lang">ts</span><pre class="shiki one-dark-pro vp-code" tabindex="0"><code><span class="line highlighted"><span style="color:#C678DD;">function</span><span style="color:#61AFEF;"> foo1</span><span style="color:#ABB2BF;">() {</span></span>
<span class="line"><span style="color:#7F848E;font-style:italic;">	// ..</span></span>
<span class="line highlighted"><span style="color:#ABB2BF;">}</span></span></code></pre><div class="line-numbers-wrapper" aria-hidden="true"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br></div></div></div></div><h2 id="包含-markdown-文件" tabindex="-1">包含 markdown 文件 <a class="header-anchor" href="#包含-markdown-文件" aria-label="Permalink to &quot;包含 markdown 文件&quot;">​</a></h2><div class="note custom-block github-alert"><p class="custom-block-title">提醒</p><p></p><p>下面<code>@/filepath</code>是导入的文件路径。示例路径是<code>@/public/snippet.md</code> @ 的值对应于源代码根目录，默认情况下是 VitePress 项目根目录，除非配置了 srcDir。或者也可以从相对路径导入：</p><p>假设 snippet.md 文件内容时如下：</p><div class="language-markdown line-numbers-mode"><button title="复制代码" class="copy"></button><span class="lang">markdown</span><pre class="shiki one-dark-pro vp-code" tabindex="0"><code><span class="line"><span style="color:#E06C75;"># snippet.md 的一级标题</span></span>
<span class="line"></span>
<span class="line"><span style="color:#E06C75;"># snippet.md 的二级标题</span></span>
<span class="line"></span>
<span class="line"><span style="color:#ABB2BF;">snippet.md 普通段落</span></span></code></pre><div class="line-numbers-wrapper" aria-hidden="true"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br></div></div></div><hr><div class="language-markdown line-numbers-mode"><button title="复制代码" class="copy"></button><span class="lang">markdown</span><pre class="shiki one-dark-pro vp-code" tabindex="0"><code><span class="line"><span style="color:#E06C75;"># Docs</span></span>
<span class="line"></span>
<span class="line"><span style="color:#E06C75;">## Basics</span></span>
<span class="line"></span>
<span class="line"><span style="color:#7F848E;font-style:italic;">&lt;!--@include: @/filepath--&gt;</span></span></code></pre><div class="line-numbers-wrapper" aria-hidden="true"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br></div></div><p>等价代码</p><div class="language-markdown line-numbers-mode"><button title="复制代码" class="copy"></button><span class="lang">markdown</span><pre class="shiki one-dark-pro vp-code" tabindex="0"><code><span class="line"><span style="color:#E06C75;"># Docs</span></span>
<span class="line"></span>
<span class="line"><span style="color:#E06C75;">## Basics</span></span>
<span class="line"></span>
<span class="line"><span style="color:#E06C75;"># snippet.md 的一级标题</span></span>
<span class="line"></span>
<span class="line"><span style="color:#E06C75;"># snippet.md 的二级标题</span></span>
<span class="line"></span>
<span class="line"><span style="color:#ABB2BF;">snippet.md 普通段落</span></span></code></pre><div class="line-numbers-wrapper" aria-hidden="true"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br></div></div><h2 id="更多" tabindex="-1">更多 <a class="header-anchor" href="#更多" aria-label="Permalink to &quot;更多&quot;">​</a></h2><p>请查看文档 <a href="https://vitepress.dev/zh/guide/markdown#header-anchors" target="_blank" rel="noreferrer">完整的 markdown 扩展列表</a>.</p></div></div></main><footer class="VPDocFooter" data-v-184b3be7 data-v-418b990b><!--[--><!--]--><div class="edit-info" data-v-418b990b><div class="edit-link" data-v-418b990b><a class="VPLink link vp-external-link-icon no-icon edit-link-button" href="https://github.com/dcdy/vitepress-template/edit/main/docs/examples/markdown-expand.md" target="_blank" rel="noreferrer" data-v-418b990b><!--[--><span class="vpi-square-pen edit-link-icon" data-v-418b990b></span> 在 GitHub 上编辑此页面<!--]--></a></div><div class="last-updated" data-v-418b990b><p class="VPLastUpdated" data-v-418b990b data-v-6a80e2fe>最后更新于: <time datetime="2024-11-29T09:16:47.000Z" data-v-6a80e2fe></time></p></div></div><nav class="prev-next" aria-labelledby="doc-footer-aria-label" data-v-418b990b><span class="visually-hidden" id="doc-footer-aria-label" data-v-418b990b>Pager</span><div class="pager" data-v-418b990b><a class="VPLink link pager-link prev" href="/vitepress-template-public/examples/markdown" data-v-418b990b><!--[--><span class="desc" data-v-418b990b>上一页</span><span class="title" data-v-418b990b>基础示例</span><!--]--></a></div><div class="pager" data-v-418b990b><a class="VPLink link pager-link next" href="/vitepress-template-public/examples/api" data-v-418b990b><!--[--><span class="desc" data-v-418b990b>下一页</span><span class="title" data-v-418b990b>API</span><!--]--></a></div></nav></footer><!--[--><!--]--></div></div></div><!--[--><!--]--></div></div><footer class="VPFooter has-sidebar" data-v-b928bd87 data-v-fdadc4f9><div class="container" data-v-fdadc4f9><p class="message" data-v-fdadc4f9>基于MIT许可发布</p><p class="copyright" data-v-fdadc4f9>版权所有 © 2024 dcdyxmt@163.com</p></div></footer><!--[--><!--]--></div></div>
    
    
  </body>
</html>